package com.baogu.factoryjob.service.impl;

import com.baogu.factoryjob.mapper.TerminalCollectionMapper;
import com.baogu.factoryjob.service.TerminalCollectionService;
import com.baogu.factoryjob.util.UuidUtil;
import com.baogu.model.job.TerminalCollection;
import com.baogu.model.job.where.TerminalCollectionWhere;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TerminalCollectionServiceImpl implements TerminalCollectionService {

    @Autowired
    TerminalCollectionMapper terminalCollectionMapper;

    @Override
    public int saveTerminalCollection(TerminalCollection terminalCollection) {
        terminalCollection.setId(UuidUtil.get32UUID());
        return terminalCollectionMapper.insertSelective(terminalCollection);
    }

    @Override
    public int saveLastTerminalCollection(TerminalCollection terminalCollection) {
        terminalCollection.setId(UuidUtil.get32UUID());
        return terminalCollectionMapper.insertSelectiveLast(terminalCollection);
    }

    @Override
    public TerminalCollection getNewTerminalCollectionData(TerminalCollectionWhere where) {
        return terminalCollectionMapper.selectLastData(where);
    }

    @Override
    public int updateLastData(TerminalCollection terminalCollection) {
        return terminalCollectionMapper.updateLastByPrimaryKeySelective(terminalCollection);
    }

    @Override
    public int saveDateLastData(TerminalCollection terminalCollection) {
        return terminalCollectionMapper.insertSelectiveLast(terminalCollection);
    }

    @Override
    public void delLast(TerminalCollectionWhere where) {
        terminalCollectionMapper.delLast(where);
    }

    @Override
    public void del(TerminalCollectionWhere where) {
        terminalCollectionMapper.del(where);
    }
}
